package com.dylan.channel.v10.attribute;

import com.dylan.channel.v10.constant.AbstractConstant;
import com.dylan.channel.v10.option.ConstantPool;

public final class AttributeKey<T> extends AbstractConstant<AttributeKey<T>> {
    public AttributeKey(int id, String name) {
        super(id, name);
    }

    private static final ConstantPool<AttributeKey<Object>> pool = new ConstantPool<AttributeKey<Object>>() {
        @Override
        protected AttributeKey<Object> newConstant(int id, String name) {
            return new AttributeKey<Object>(id, name);
        }
    };

    /**
     * @Author: PP-jessica
     * @Description:创建key的方法
     */
    @SuppressWarnings("unchecked")
    public static <T> AttributeKey<T> valueOf(String name) {
        return (AttributeKey<T>) pool.valueOf(name);
    }

}
